<template>
  <div class="qa-system-container">
    <div class="page-header">
      <h2>智能问答</h2>
      <div class="header-actions">
        <button class="btn-primary">训练模型</button>
        <button class="btn-secondary">问答历史</button>
      </div>
    </div>
    
    <div class="qa-interface">
      <div class="chat-container">
        <div class="chat-messages">
          <div class="message user">
            <p>你好，我想了解Vue.js的基本概念</p>
          </div>
          <div class="message bot">
            <p>Vue.js是一个渐进式JavaScript框架，用于构建用户界面。它具有以下特点：</p>
            <ul>
              <li>响应式数据绑定</li>
              <li>组件化开发</li>
              <li>虚拟DOM</li>
              <li>丰富的生态系统</li>
            </ul>
          </div>
          <div class="message user">
            <p>Vue.js和React有什么区别？</p>
          </div>
          <div class="message bot">
            <p>Vue.js和React都是优秀的前端框架，主要区别在于：</p>
            <ul>
              <li>Vue.js使用模板语法，React使用JSX</li>
              <li>Vue.js的双向数据绑定更直观</li>
              <li>React的生态系统更庞大</li>
              <li>学习曲线不同</li>
            </ul>
          </div>
        </div>
        <div class="chat-input">
          <input type="text" placeholder="请输入您的问题..." />
          <button class="send-btn">发送</button>
        </div>
      </div>
    </div>
    
    <div class="qa-features">
      <div class="feature-card">
        <div class="feature-icon">❓</div>
        <div class="feature-content">
          <h3>智能问答</h3>
          <p>基于知识库的智能问答系统</p>
        </div>
      </div>
      
      <div class="feature-card">
        <div class="feature-icon">📜</div>
        <div class="feature-content">
          <h3>问答历史</h3>
          <p>查看和管理历史问答记录</p>
        </div>
      </div>
      
      <div class="feature-card">
        <div class="feature-icon">🕸️</div>
        <div class="feature-content">
          <h3>知识图谱</h3>
          <p>可视化知识关系和网络</p>
        </div>
      </div>
      
      <div class="feature-card">
        <div class="feature-icon">🎓</div>
        <div class="feature-content">
          <h3>问答训练</h3>
          <p>训练和优化问答模型</p>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
// 智能问答组件逻辑
</script>

<style scoped>
.qa-system-container {
  padding: 0;
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.page-header h2 {
  color: var(--text-primary);
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
}

.header-actions {
  display: flex;
  gap: 1rem;
}

.btn-primary {
  background: var(--accent-color);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  cursor: pointer;
  font-weight: 500;
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  cursor: pointer;
  font-weight: 500;
}

.qa-interface {
  max-width: 800px;
  margin: 0 auto 2rem auto;
}

.chat-container {
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  overflow: hidden;
  background: var(--bg-primary);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.chat-messages {
  height: 400px;
  overflow-y: auto;
  padding: 1rem;
  background: var(--bg-tertiary);
}

.message {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  max-width: 70%;
}

.message.user {
  background: #4f46e5;
  color: white;
  margin-left: auto;
}

.message.bot {
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.message ul {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.message li {
  margin: 0.25rem 0;
}

.chat-input {
  display: flex;
  padding: 1rem;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
}

.chat-input input {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  margin-right: 0.5rem;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  outline: none;
}

.chat-input input:focus {
  border-color: var(--accent-color);
}

.send-btn {
  background: var(--accent-color);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 0.375rem;
  cursor: pointer;
  font-weight: 500;
}

.send-btn:hover {
  background: var(--accent-hover);
}

.qa-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.feature-card {
  background: var(--bg-primary);
  color: var(--text-primary);
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.feature-icon {
  font-size: 2rem;
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border-radius: 0.5rem;
}

.feature-content {
  flex: 1;
}

.feature-content h3 {
  color: var(--text-primary);
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
}

.feature-content p {
  color: var(--text-secondary);
  margin: 0;
  font-size: 0.875rem;
}

@media (max-width: 768px) {
  .qa-features {
    grid-template-columns: 1fr;
  }
}
</style>
